package com.itheima.HashSet;

import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;

public class HashSetDemo {
    public static void main(String[] args) {
        HashSet<String>hs=new HashSet<>();
        hs.add("hello");
        hs.add("hell");
        hs.add("hel");
        hs.add("he");
        hs.add("h");

        Iterator<String>it=hs.iterator();
        while (it.hasNext()){
            String s=it.next();
            System.out.print(s+"   ");
        }
        System.out.println("|||||||||||||||||||||||||");
        for (String s : hs) {
            System.out.print(s+"   ");
        }
        System.out.println("|||||||||||||||||||||||||");
        hs.forEach(s-> System.out.print(s+"   "));


    }
}
